package feixun.ListViewTest;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.ViewSwitcher;

public class ListViewTest extends Activity
{
    private ListView fileLV;
    private List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
    private LayoutInflater myInflater; 
    private ViewSwitcher headerView;

    private List<Map<String, Object>> getData()
    {
        Map<String, Object> map = new HashMap<String, Object>();

        map.put("img", R.drawable.ic_camera_normal);
        map.put("text", "Camera");
        list.add(map);
        map = new HashMap<String, Object>();
        map.put("img", R.drawable.ic_download_normal);
        map.put("text", "Download");
        list.add(map);
        map = new HashMap<String, Object>();
        map.put("img", R.drawable.ic_music_normal);
        map.put("text", "Music");
        list.add(map);
        map = new HashMap<String, Object>();
        map.put("img", R.drawable.ic_pictrue_normal);
        map.put("text", "Photo");
        list.add(map);
        map = new HashMap<String, Object>();
        map.put("img", R.drawable.ic_vedio_normal);
        map.put("text", "Video");
        list.add(map);
        return list;

    };

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        fileLV = (ListView) findViewById(R.id.fileLV);
        list = getData();
        SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.list_item, new String[]
        { "img", "text" }, new int[]
        { R.id.listItemImage, R.id.listItemText });

    }
    protected final class ItemViewHolder
    {
        protected ImageView im;
        protected TextView tv;
    }
}